<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>学校管理</title>
	<meta name="decorator" content="default"/>
	<meta http-equiv="Cache-Control" content="no-cache,must-revalidate">
	<script type="text/javascript">
		$(document).ready(function() {
			$("#schName").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					/* loading('正在提交，请稍等...');
					form.submit(); */
					postOrderDetil(form);
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			/* $("#schCode").blur(function(){
				var schCode = $("#schCode").val();
				var url = "${ctx}/student/student/findByCode";
				$.ajax({
					url :url,
					async: false,
					data :{"id":schCode},
					success : function(data){
						if(data ！= null){
							return "编码重复，请核对后重新输入！";
						}else{
							return;
					    }
					}
				});
			}); */
		});
		
		function postOrderDetil(form) {//表单保存时  将此方法中的数据尽行保存
			layer.confirm('确定保存？', {
				icon: 3, title:'提示',
				btn : [ '保存', '取消' ]
			//按钮
			}, function() {
				layer.load(2);
				loading('正在提交，请稍等...');
				form.submit();
			});
		}
	</script>
</head>
<body>
	<form:form id="inputForm" modelAttribute="sysSchool" action="${ctx}/sysschool/sysSchool/save" method="post" class="form-horizontal" autocomplete="off">
		<form:hidden path="id"/>
		<form:hidden path="parentId"/>
		<form:hidden path="schType"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label"><font color="red">*</font>名称：</label>
			<div class="controls">
				<form:input path="schName" htmlEscape="false" maxlength="50" class="input-xlarge required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><font color="red">*</font>编码：</label>
			<div class="controls">
				<form:input path="schCode" htmlEscape="false" maxlength="50" class="input-xlarge"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><font color="red">*</font>归属区域：</label>
			<div class="controls">
			   <sys:treeselect2 id="parentCode" name="parentCode" value="${sysSchool.parentCode}" labelName="parentName" labelValue="${sysSchool.parentName}"
			    title="年级或班级" url="/sysschool/sysSchool/schTreeData" cssClass="input-medium" layer = "true"/>
			</div>
		</div>
		<%-- <div class="control-group">
			<label class="control-label"><font color="red">*</font>学校级别：</label>
			<div class="controls">
				<form:select path="schType" class="span2 minWidth">
					<form:option value="" label="--请选择--"/>
					<form:options items="${fns:getDictList('schType')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</div>
		</div> --%>
		<%-- <div class="control-group">
			<label class="control-label"><font color="red">*</font>学校类型：</label>
			<div class="controls">
				<form:select path="type" class="span2 minWidth" disable="true">
					<form:option value="" label="--请选择--"/>
					<form:options items="${fns:getDictList('type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</div>
		</div> --%>
		<%-- <div class="control-group">
			<label class="control-label">体检日期：</label>
			<div class="controls">
				<form:input path="physicalDate" htmlEscape="false" maxlength="10" class="input-xlarge "/>
				<input name="physicalDate" id ="physicalDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
							value="<fmt:formatDate value="${sysSchool.physicalDate}" pattern="yyyy-MM-dd"/>"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
			</div>
		</div> --%>
		<%-- <div class="control-group">
			<label class="control-label">入学年份：</label>
			<div class="controls">
				<form:input path="enrlYear" htmlEscape="false" maxlength="10" class="input-xlarge "/>
			</div>
		</div> --%>
		<div class="control-group">
			<label class="control-label">备注：</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="500" class="input-xxlarge "/>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="sysschool:sysSchool:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>